﻿using Athena.Performance.Models;
using Athena.Performance.Models.Arguments;
using Athena.ProxyGenerator;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Zeus.Mvc.Controllers;

namespace Athena.Performance.Compare
{
    public class CompareController : ZeusController
    {
        private readonly IServiceProxyFactory _serviceProxyFactory;
        public CompareController(IServiceProxyFactory serviceProxyFactory)
        {
            _serviceProxyFactory = serviceProxyFactory;
        }
        [Route("Compare/Athena/Performance")]
        [HttpPost]
        public async Task<string> AthenaPerformance(ArguUserLogin arguUserLogin)
        {
            var user = _serviceProxyFactory.CreateProxy<IUser>();
            var resultUserLogin = await user.Login(arguUserLogin);
            return resultUserLogin.Token;
        }

        [Route("Compare/Athena/Masstransit")]
        public async Task<string> AthenaMasstransit(ArguUserLogin arguUserLogin)
        {
            var a = System.Guid.NewGuid();
            var response = await UserLoginRequest.Client.Request(new UserLoginRequest(a)
            {
                UserName= arguUserLogin.UserName,
                Password = arguUserLogin.Password
            });
            return response.Token;
        }
    }
}
